<template>
	<div class="product_detail">
		<h3>{{productIdData.title}}</h3>
		<p>{{productIdData.content}}</p>

		<input type="button" name="" value="立即申请" @click="applyNow(productIdData.id)">
		
	</div>

</template>


<script>
	export default ({
		name:'productDetail',
		data(){
			return{
				productIdData:'',
				productID:''
			}
		},
		methods : {
			getproductId(){
				this.productID = this.$route.query.id
				console.log(this)
			},
			getDesByProductId(){
				var that = this
				this.$ajax({
					url:'/api/home/detail',
					method:'post',
					data:{
						id:that.productID
					}
				})
				.then(function(res){
					console.log(res)
					if(res.data.code == 200){
						that.productIdData = res.data.data
					}
				})
			},
			//立即申请
			applyNow(id){
				this.$router.push({
					path:'/applyNow',
					query:{
						pId:id
					}

				})
			}
		},
		
		created(){
			this.getproductId();
			this.getDesByProductId()
		}
	})

</script>



<style scoped lang="less">
	.product_detail{
		width: 500px;height: 100%;margin:20px auto;
		h3{
			height:40px;line-height:40px;text-align: center;
		}
		p{
			text-indent:2em;
		}
	}
	input{padding:10px;border-radius: 10px;margin-top: 20px;outline:none;background-color: #ccc;width:120px;display: block;margin:20px auto;}

</style>